/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import core.AEntityContentProvider;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ivan
 */
@Entity
@Table(name = "TEAM_CONTRACT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TeamContract.findAll", query = "SELECT t FROM TeamContract t"),
    @NamedQuery(name = "TeamContract.findByTeamContractId", query = "SELECT t FROM TeamContract t WHERE t.teamContractId = :teamContractId")})
public class TeamContract extends AEntityContentProvider<TeamContract> implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    //@Basic(optional = false)
    //@NotNull
    @GeneratedValue(generator="CommonSeq", strategy= GenerationType.SEQUENCE)
    //@SequenceGenerator( name="CommonSeq",sequenceName="common_seq", allocationSize=1)
    @Column(name = "TEAM_CONTRACT_ID")
    private BigDecimal teamContractId;
    @JoinColumn(name = "TEAM_ID", referencedColumnName = "TEAM_ID")
    @ManyToOne
    private Team teamId;
    @JoinColumn(name = "PLAYER_ID", referencedColumnName = "PLAYER_ID")
    @ManyToOne
    private Player playerId;

    public TeamContract() {
    }

    public TeamContract(BigDecimal teamContractId) {
        super(TeamContract.class);
        this.teamContractId = teamContractId;
    }

    public BigDecimal getTeamContractId() {
        return teamContractId;
    }

    public void setTeamContractId(BigDecimal teamContractId) {
        this.teamContractId = teamContractId;
    }

    public Team getTeamId() {
        return teamId;
    }

    public void setTeamId(Team teamId) {
        this.teamId = teamId;
    }

    public Player getPlayerId() {
        return playerId;
    }

    public void setPlayerId(Player playerId) {
        this.playerId = playerId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (teamContractId != null ? teamContractId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TeamContract)) {
            return false;
        }
        TeamContract other = (TeamContract) object;
        if ((this.teamContractId == null && other.teamContractId != null) || (this.teamContractId != null && !this.teamContractId.equals(other.teamContractId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.TeamContract[ teamContractId=" + teamContractId + " ]";
    }
    
}
